package utils

import (
	"github.com/gotk3/gotk3/gtk"
)

func ShowCustomerAlert(window *gtk.Window, title string, content string) gtk.ResponseType {
	builder, _ := gtk.BuilderNewFromFile("ui/customerAlert.glade")

	// 获取相应控件
	dialogObj, _ := builder.GetObject("dialog1")
	dialog, _ := dialogObj.(*gtk.Dialog)

	labelObj, _ := builder.GetObject("label1")
	label, _ := labelObj.(*gtk.Label)
	label.SetLabel(content)

	//不需要设置父级，否则警告Can't set a parent on a toplevel widget
	//window.Add(dialog)

	dialog.SetTitle(title)
	//注意，使用show将导致界面卡顿
	//dialog.Show()

	defer dialog.Destroy()
	//将返回按钮的id
	return dialog.Run()
}
